package experiment03;

import java.util.Scanner;

public class TestLinearEquation {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double x1 = scanner.nextDouble();
        double y1 = scanner.nextDouble();
        double x2 = scanner.nextDouble();
        double y2 = scanner.nextDouble();

        double x3 = scanner.nextDouble();
        double y3 = scanner.nextDouble();
        double x4 = scanner.nextDouble();
        double y4 = scanner.nextDouble();

        double a,b,c,d,e,f;
        a = y1 - y2;
        b = x2 - x1;
        c = y3 - y4;
        d = x4 - x3;
        e = a*x1 + b*y1;
        f = c*x3 + d*y3;

        LinearEquation1 linearEquation1 = new LinearEquation1(a,b,c,d,e,f);

        if(linearEquation1.isSolvable()){
            System.out.println("x:" + linearEquation1.getX() + "\t" + "y:" + linearEquation1.getY());
        }
        else {
            System.out.println("The tow line are parallel");
        }
    }

}
